package com.app.service.impl;

import com.app.mapper.CusResumeLangskillMapper;
import com.app.mapper.EnterpriseMapper;
import com.app.model.CusResumeLangModel;
import com.app.model.EnterpriseModel;
import com.app.service.CusResumeLangskillService;
import com.app.service.EnterpriseService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Description:语言实现类
 * @Author: N
 * @Date: 2022年11月24日 10点29分
 */
@Service
public class CusResumeLangskillServiceImpl implements CusResumeLangskillService {

    @Autowired
    CusResumeLangskillMapper cusResumeLangskillMapper;

    @Override
    public List<CusResumeLangModel> findByCustomerId(int customerId) {
        QueryWrapper<CusResumeLangModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("customer_id",customerId);
        List<CusResumeLangModel> userList = cusResumeLangskillMapper.selectList(queryWrapper);
        if(userList.isEmpty())
        {
            return null;
        }else {
            return userList;
        }
    }

    @Override
    public CusResumeLangModel findLangById(int id) {
        QueryWrapper<CusResumeLangModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("id",id);
        List<CusResumeLangModel> userList = cusResumeLangskillMapper.selectList(queryWrapper);
        if(userList.isEmpty())
        {
            return null;
        }else {
            return userList.get(0);
        }
    }

    @Override
    public void delete(int id) {
        cusResumeLangskillMapper.deleteById(id);
    }

    @Override
    public void update(CusResumeLangModel model) {
        cusResumeLangskillMapper.updateById(model);
    }

    @Override
    public int insert(CusResumeLangModel model) {

        return cusResumeLangskillMapper.insert(model);
    }
}
